package com.ywh.hilttest.test2

import android.os.Bundle
import androidx.fragment.app.Fragment
import com.ywh.hilttest.test2.dynamic_param.SdkDynamicParamObjectFactory
import com.ywh.hilttest.test2.dynamic_param2.SdkDynamicParam2ObjectWrapper
import com.ywh.hilttest.test2.no_param.SdkObject
import com.ywh.hilttest.test2.static_param.SdkStaticParamObject
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class FragmentSdkObject : Fragment() {
    //sdk无参对象
    @Inject
    lateinit var sdkObject: SdkObject

    //sdk静态参数对象
    @Inject
    lateinit var sdkStaticParamObject: SdkStaticParamObject

    //sdk动态参数，通过本地定义工厂，工厂创建对象并传参
    @Inject
    lateinit var sdkDynamicParamObjectFactory: SdkDynamicParamObjectFactory

    //sdk动态参数，通过Wrapper对象包裹sdk对象，本地创建Wrapper对象，来获取sdk对象并传参
    @Inject
    lateinit var sdkDynamicParam2ObjectWrapper: SdkDynamicParam2ObjectWrapper

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        sdkObject.test()

        sdkStaticParamObject.test()

        val sdkDynamicParamObject = sdkDynamicParamObjectFactory.create("12345560000")
        sdkDynamicParamObject.test()

        sdkDynamicParam2ObjectWrapper.initialize("1234567890")
        sdkDynamicParam2ObjectWrapper.sdkDynamicParam2Object.test()

    }
}